//-----------------------------------------------------------------------------
// File: util_matrix.h
//
// Desc: matrix class.
//       build20070218
//
// Author: Silva Lam
//-----------------------------------------------------------------------------
#ifndef _UTIL_MATRIX_H_
#define _UTIL_MATRIX_H_
#include "xtypes.h"
#include "util_datadef.h"
#include "xaux.h"
#include "xmath.h"





matrix4x4_t xMatrix4x4Add(matrix4x4_t L, matrix4x4_t R);
matrix4x4_t xMatrix4x4Sub(matrix4x4_t L, matrix4x4_t R);
matrix4x4_t xMatrix4x4Mul(matrix4x4_t L, matrix4x4_t R);
matrix4x4_t xMatrix4x4Scale(matrix4x4_t M, float_t s);
matrix4x4_t xMatrix4x4Transpose(matrix4x4_t M);


point3_t xPt3MulMat4x4(point3_t p3d, matrix4x4_t m44);
point4_t xPt4MulMat4x4(point4_t p4d, matrix4x4_t m44);




class CMatrix4x4 : public matrix4x4_t
{
public:
	CMatrix4x4();
	CMatrix4x4(matrix4x4_t& mat);
	~CMatrix4x4();

	void SetMatrix(int_t row, int_t column, float_t elem);
	void SetMatrix(int_t series, float_t);
	float_t& fnMatrix(int_t row, int_t column);
	float_t& fnMatrix(int_t series);

	void LoadZeros();
	void LoadIdentity();

	CMatrix4x4 operator+(CMatrix4x4 R);
	CMatrix4x4 operator-(CMatrix4x4 R);
	CMatrix4x4 operator*(float_t R);
	CMatrix4x4 operator*(CMatrix4x4 R);
	CMatrix4x4 operator~();

};


#endif //_UTIL_MATRIX_H_

